import 'package:flutter/material.dart';
import 'package:wallpaper/components/placeholder/appbar_base.dart';
import 'package:wallpaper/components/my_types.dart';
import 'package:wallpaper/pages/other/ManyACG/ManyACG.dart';
import 'package:wallpaper/pages/other/bocchi/bocchi_page.dart';
import 'package:wallpaper/pages/other/bocchi/bocchi_video.dart';
import 'package:wallpaper/pages/other/mohu/mohu_hpage.dart';
import 'package:wallpaper/pages/other/nekosia/nekosia_page.dart';
import 'package:wallpaper/pages/other/wallhaven/wallhaven_page.dart';
import 'package:wallpaper/pages/other/360/class_360.dart';
import 'package:wallpaper/pages/other/360/image_list_new_360.dart';
import 'package:wallpaper/pages/other/suyan/random_image.dart';
import 'package:wallpaper/pages/other/suyan/random_video.dart';
import 'package:wallpaper/pages/other/moe/moe_page.dart';
import 'package:wallpaper/pages/other/mohu/mohu_page.dart';
import 'package:wallpaper/pages/other/pixiv/pixiv_image.dart';
import 'package:wallpaper/pages/other/suyan/random_image_pc.dart';

class MyPage extends StatelessWidget {
  const MyPage({super.key});

  @override
  Widget build(BuildContext context) {
    String bgBase =
        'https://gitee.com/zsnoin-can/new-wall-paper-apk/raw/master/bg';
    final List wallpapges = [
      {
        'name': '波奇壁纸',
        'page': const BocchiPage(isPC: true),
        'bg': '$bgBase/bocchih.jpg',
      },
      {
        'name': '360分类',
        'page': const Class360(),
        'bg': '$bgBase/360.jpg',
      },
      {
        'name': '360最新',
        'page': const ImageListNew360(),
        'bg': '$bgBase/360new.jpg',
      },
      {
        'name': 'Loveanimer',
        'page': const RandomImagePc(),
        'bg': '$bgBase/loveh.jpg',
      },
      {
        'name': '萌虎',
        'page': const MohuHpage(),
        'bg': '$bgBase/mohh.jpg',
      },
    ];

    final List verticals = [
      {
        'name': '波奇壁纸',
        'page': const BocchiPage(),
        'bg': '$bgBase/bocchi.jpg',
      },
      {
        'name': 'Wallhaven',
        'page': const WallhavenPage(),
        'bg': '$bgBase/wallhaven.jpg',
      },
      {
        'name': 'ManyACG',
        'page': const ManyACG(),
        'bg': '$bgBase/manyacg.jpg',
      },
      {
        'name': 'Nekosia',
        'page': const NekosiaPage(),
        'bg': '$bgBase/nekosia.jpg',
      },
      {
        'name': 'Loveanimer',
        'page': const RandomImage(),
        'bg': '$bgBase/lovev.jpg',
      },
      {
        'name': '萌える嘘',
        'page': const MoePage(),
        'bg': '$bgBase/moe.jpg',
      },
      {
        'name': '萌虎',
        'page': const MohuPage(),
        'bg': '$bgBase/moh.jpg',
      },
      {
        'name': 'Pixiv',
        'page': const PixivImage(),
        'bg': '$bgBase/pixiv.jpg',
      },
    ];

    final List videos = [
      {
        'name': '波奇壁纸',
        'page': const BocchiVideo(),
        'bg': '$bgBase/bocchiv.jpg',
      },
      {
        'name': 'Loveanimer',
        'page': const RandomVideo(),
        'bg': '$bgBase/video.jpg',
      },
    ];
    return Scaffold(
      appBar: AppbarBase(title: '壁纸库'),
      body: SingleChildScrollView(
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            buildTitle('横屏'),
            MyTypes(
              wallpapges: wallpapges.map((e) {
                TypesBase item = TypesBase(
                  name: e['name'],
                  page: e['page'],
                  bg: e['bg'],
                );
                return item;
              }).toList(),
              vertical: false,
              isScroll: false,
            ),
            buildTitle('竖屏'),
            MyTypes(
                wallpapges: verticals.map((e) {
                  TypesBase item = TypesBase(
                    name: e['name'],
                    page: e['page'],
                    bg: e['bg'],
                  );
                  return item;
                }).toList(),
                vertical: true),
            buildTitle('视频'),
            MyTypes(
                wallpapges: videos.map((e) {
                  TypesBase item = TypesBase(
                    name: e['name'],
                    page: e['page'],
                    bg: e['bg'],
                  );
                  return item;
                }).toList(),
                vertical: true),
          ],
        ),
      ),
    );
  }

  Widget buildTitle(String title) {
    return Padding(
      padding: const EdgeInsets.only(top: 10, bottom: 5, left: 10),
      child: Text(title,
          style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
    );
  }
}
